package com.zhs.base.loadbalance;

import java.util.List;

/**
 * 轮询
 *
 * @author huang.
 * @date 2022年08月08日 10:45.
 */
public class Polling {
    private static Integer pos = 0;

    public synchronized static <T> T getServer(List<T> serverList) {
        if (pos >= serverList.size()) {
            pos = 0;
        }
        T server = serverList.get(pos);
        pos++;
        return server;
    }

}
